//---------------------------------------------------------------------------


#pragma hdrstop

#include "AdWave.h"
#include "Filter.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)


TAdWave* TAdWave::m_AdWaveObj = NULL;
TAdWave* TAdWave::GetInstance()
{

    if(m_AdWaveObj == NULL)
      m_AdWaveObj = new TAdWave();
    return  m_AdWaveObj;
}

TAdWave::TAdWave():CBusiness()
{
     m_filter = new TFilter(1,400);
     m_hdr->m_FrameHeader[0] = 0xab;
     m_hdr->m_FrameHeader[1] = 0xcd;
     m_hdr->m_FrameHeader_Len = 2;
     m_hdr->m_FrameLength = 10;
     m_hdr->m_type = 1;

}
TAdWave::~TAdWave()
{
    // if(TAdWave::m_AdWaveObj)
       // delete (TAdWave::m_AdWaveObj);
}

int  TAdWave::PraseFrame(TCommunication* comm,UINT8* packetBuf, UINT32 len)
{
     return CBusiness::PraseFrame(comm,packetBuf,  len);
  
}
void TAdWave::Disposal(TCommunication* commu,UINT8* packetBuf, UINT32 len)
{

    m_frame->m_AD1 = (packetBuf[2]<<8) + packetBuf[3];
    m_frame->m_AD2 = (packetBuf[4]<<8) + packetBuf[5];
    m_frame->m_weight = (packetBuf[6]<<24) + (packetBuf[7]<<16) + (packetBuf[8]<<8);
    m_frame->m_weight = (m_frame->m_weight>>8);
    m_frame->m_Dir = packetBuf[9];
    NotifyView(commu,this);

}

